﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<QianBuo.Lottery.Web.Models.Play.PlayTypeModel>" %>
<%@ Import Namespace="Code.Models" %>
<div>
    <div id="play_inputpanel">
        <%
            var QianYiShuTou = (PlayType_E)ViewData["QianYiShuTou"];
            var QianYiHongTou = (PlayType_E)ViewData["QianYiHongTou"];
            var XuanErLianZhi = (PlayType_E)ViewData["XuanErLianZhi"];
            var XuanSanQianZhi = (PlayType_E)ViewData["XuanSanQianZhi"];    
        %>
        <table border="0" cellpadding="0" cellspacing="5" class="play_play_input" align="center" id="MyTable">
            <tr id="input_model">
                <td colspan="12" >
                    <input type="radio" name="inputtype" class='type<%=(int)QianYiShuTou %>' id='前一数投'
                        value='<%=(int)QianYiShuTou %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=QianYiShuTou}) %>' /><label
                            for='前一数投'>前一数投</label>
                    <input type="radio" name="inputtype" class='type<%=(int)QianYiHongTou %>' id='前一红投'
                        value='<%=(int)QianYiHongTou %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=QianYiHongTou}) %>' /><label
                            for='前一红投'>前一红投</label>
                    <input type="radio" name="inputtype" class='type<%=(int)XuanErLianZhi %>' id='选二连直'
                        value='<%=(int)XuanErLianZhi %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=XuanErLianZhi}) %>' /><label
                            for='选二连直'>选二连直</label>
                    <input type="radio" name="inputtype" class='type<%=(int)XuanSanQianZhi %>' id='选三前直'
                        value='<%=(int)XuanSanQianZhi %>' surl='<%=Url.RouteUrl("Play_Single",new{p1=XuanSanQianZhi}) %>' /><label
                            for='选三前直'>选三前直</label>
                </td>
            </tr>
            <tbody class="tb1" style="display: block">
                <tr class="tr_number" id="p10">
                    <td class="head">
                        小
                    </td>
                    <td class="number">
                        1
                    </td>
                    <td class="number">
                        2
                    </td>
                    <td class="number">
                        3
                    </td>
                    <td class="number">
                        4
                    </td>
                    <td class="number">
                        5
                    </td>
                    <td class="number">
                        6
                    </td>
                    <td class="number">
                        7
                    </td>
                    <td class="number">
                        8
                    </td>
                    <td class="number">
                        9
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p100">
                    <td class="head">
                        大
                    </td>
                    <td class="number">
                        10
                    </td>
                    <td class="number">
                        11
                    </td>
                    <td class="number">
                        12
                    </td>
                    <td class="number">
                        13
                    </td>
                    <td class="number">
                        14
                    </td>
                    <td class="number">
                        15
                    </td>
                    <td class="number">
                        16
                    </td>
                    <td class="number">
                        17
                    </td>
                    <td class="number">
                        18
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </tbody>
            <tbody class="tb2" style="display: none">
                <tr class="tr_number" id="p1000">
                    <td class="head">
                        号码
                    </td>
                    <td class="number" id="19">
                        19
                    </td>
                    <td class="number" id="20" >
                        20
                    </td>
                    <td colspan="9">
                        &nbsp;
                    </td>
                </tr>
            </tbody>
            <tbody class="tb3" style="display: none">
                <tr class="tr_number" id="p2">
                    <td class="head">
                        第一位
                    </td>
                    <td class="number">
                        1
                    </td>
                    <td class="number">
                        2
                    </td>
                    <td class="number">
                        3
                    </td>
                    <td class="number">
                        4
                    </td>
                    <td class="number">
                        5
                    </td>
                    <td class="number">
                        6
                    </td>
                    <td class="number">
                        7
                    </td>
                    <td class="number">
                        8
                    </td>
                    <td class="number">
                        9
                    </td>
                    <td class="number">
                        10
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p3">
                    <td>
                        &nbsp;
                    </td>
                    <td class="number">
                        11
                    </td>
                    <td class="number">
                        12
                    </td>
                    <td class="number">
                        13
                    </td>
                    <td class="number">
                        14
                    </td>
                    <td class="number">
                        15
                    </td>
                    <td class="number">
                        16
                    </td>
                    <td class="number">
                        17
                    </td>
                    <td class="number">
                        18
                    </td>
                    <td class="number">
                        19
                    </td>
                    <td class="number">
                        20
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p4">
                    <td class="head">
                        第二位
                    </td>
                    <td class="number">
                        1
                    </td>
                    <td class="number">
                        2
                    </td>
                    <td class="number">
                        3
                    </td>
                    <td class="number">
                        4
                    </td>
                    <td class="number">
                        5
                    </td>
                    <td class="number">
                        6
                    </td>
                    <td class="number">
                        7
                    </td>
                    <td class="number">
                        8
                    </td>
                    <td class="number">
                        9
                    </td>
                    <td class="number">
                        10
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p5">
                    <td>
                        &nbsp;
                    </td>
                    <td class="number">
                        11
                    </td>
                    <td class="number">
                        12
                    </td>
                    <td class="number">
                        13
                    </td>
                    <td class="number">
                        14
                    </td>
                    <td class="number">
                        15
                    </td>
                    <td class="number">
                        16
                    </td>
                    <td class="number">
                        17
                    </td>
                    <td class="number">
                        18
                    </td>
                    <td class="number">
                        19
                    </td>
                    <td class="number">
                        20
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </tbody>
            <tbody class="tb4" style="display: none">
                <tr class="tr_number" id="p6">
                    <td class="head">
                        第一位
                    </td>
                    <td class="number">
                        1
                    </td>
                    <td class="number">
                        2
                    </td>
                    <td class="number">
                        3
                    </td>
                    <td class="number">
                        4
                    </td>
                    <td class="number">
                        5
                    </td>
                    <td class="number">
                        6
                    </td>
                    <td class="number">
                        7
                    </td>
                    <td class="number">
                        8
                    </td>
                    <td class="number">
                        9
                    </td>
                    <td class="number">
                        10
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p7">
                    <td>
                        &nbsp;
                    </td>
                    <td class="number">
                        11
                    </td>
                    <td class="number">
                        12
                    </td>
                    <td class="number">
                        13
                    </td>
                    <td class="number">
                        14
                    </td>
                    <td class="number">
                        15
                    </td>
                    <td class="number">
                        16
                    </td>
                    <td class="number">
                        17
                    </td>
                    <td class="number">
                        18
                    </td>
                    <td class="number">
                        19
                    </td>
                    <td class="number">
                        20
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p8">
                    <td class="head">
                        第二位
                    </td>
                    <td class="number">
                        1
                    </td>
                    <td class="number">
                        2
                    </td>
                    <td class="number">
                        3
                    </td>
                    <td class="number">
                        4
                    </td>
                    <td class="number">
                        5
                    </td>
                    <td class="number">
                        6
                    </td>
                    <td class="number">
                        7
                    </td>
                    <td class="number">
                        8
                    </td>
                    <td class="number">
                        9
                    </td>
                    <td class="number">
                        10
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p9">
                    <td>
                        &nbsp;
                    </td>
                    <td class="number">
                        11
                    </td>
                    <td class="number">
                        12
                    </td>
                    <td class="number">
                        13
                    </td>
                    <td class="number">
                        14
                    </td>
                    <td class="number">
                        15
                    </td>
                    <td class="number">
                        16
                    </td>
                    <td class="number">
                        17
                    </td>
                    <td class="number">
                        18
                    </td>
                    <td class="number">
                        19
                    </td>
                    <td class="number">
                        20
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p11">
                    <td class="head">
                        第三位
                    </td>
                    <td class="number">
                        1
                    </td>
                    <td class="number">
                        2
                    </td>
                    <td class="number">
                        3
                    </td>
                    <td class="number">
                        4
                    </td>
                    <td class="number">
                        5
                    </td>
                    <td class="number">
                        6
                    </td>
                    <td class="number">
                        7
                    </td>
                    <td class="number">
                        8
                    </td>
                    <td class="number">
                        9
                    </td>
                    <td class="number">
                        10
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr class="tr_number" id="p12">
                    <td>
                        &nbsp;
                    </td>
                    <td class="number">
                        11
                    </td>
                    <td class="number">
                        12
                    </td>
                    <td class="number">
                        13
                    </td>
                    <td class="number">
                        14
                    </td>
                    <td class="number">
                        15
                    </td>
                    <td class="number">
                        16
                    </td>
                    <td class="number">
                        17
                    </td>
                    <td class="number">
                        18
                    </td>
                    <td class="number">
                        19
                    </td>
                    <td class="number">
                        20
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </tbody>
            <tr id="playinfo">
                <td colspan="12" style="text-align: left">
                    <%=Model.Remark %>
                </td>
            </tr>
            <tr>
                <td colspan="6" id="sumcount">
                    注数:<font color="red">0</font>
                </td>
                <td colspan="6" align="left">
                    <input type="button" name="bet_play_btnadd" id="bet_play_btnadd" value="添加" class="bet_play_btnadd"
                        onclick="PaiLieZhiXuan.addScheme()" />
                </td>
            </tr>
        </table>
        <script type="text/javascript">

         var __playid=<%=Model.PlayID %>;
            $(document).ready(showWinInfo);
            function showWinInfo(){
                var pwin = Site.Lottery.Bet.GetPlayTypeWinMoney(function(item){ return item.PlayTypeID == __playid;});
                if(pwin != null)
                    $('<span><%=string.IsNullOrEmpty(Model.Remark) ? "" : "，" %>'+"奖金:<font color='red'>"+pwin.WinMoney+"元</font></span>").appendTo($("#playinfo td"));
                else
                    window.setTimeout(showWinInfo,500);
            }
            $(".play_play_input .number").click(function () {
                var item = $(this);
                var id = item.parent().attr("id");
                id = id.replace(/\s+/g, "");
                if (item.is(".select")) {
                    if (id == "p1000") {
                        item.removeClass("select");
                        PaiLieZhiXuan.HongTuoCout=0;
                        PaiLieZhiXuan.HongTuo="";
                        $("#19").removeClass("select");
                        $("#20").removeClass("select");
                    } else {
                        item.removeClass("select");
                        switch (id) {
                            case "p10":
                                PaiLieZhiXuan.ChooseNumber10 = PaiLieZhiXuan.ChooseNumber10.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber10Count--;
                                break;
                            case "p100":
                                PaiLieZhiXuan.ChooseNumber100 = PaiLieZhiXuan.ChooseNumber100.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber100Count--;
                                break;
                            case "p2":
                                PaiLieZhiXuan.ChooseNumber2 = PaiLieZhiXuan.ChooseNumber2.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber2Count--;
                                break;
                            case "p3":
                                PaiLieZhiXuan.ChooseNumber3 = PaiLieZhiXuan.ChooseNumber3.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber3Count--;
                                break;
                            case "p4":
                                PaiLieZhiXuan.ChooseNumber4 = PaiLieZhiXuan.ChooseNumber4.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber4Count--;
                                break;
                            case "p5":
                                PaiLieZhiXuan.ChooseNumber5 = PaiLieZhiXuan.ChooseNumber5.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber5Count--;
                                break;
                            case "p6":
                                PaiLieZhiXuan.ChooseNumber6 = PaiLieZhiXuan.ChooseNumber6.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber6Count--;
                                break;
                            case "p7":
                                PaiLieZhiXuan.ChooseNumber7 = PaiLieZhiXuan.ChooseNumber7.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber7Count--;
                                break;
                            case "p8":
                                PaiLieZhiXuan.ChooseNumber8 = PaiLieZhiXuan.ChooseNumber8.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber8Count--;
                                break;
                            case "p9":
                                PaiLieZhiXuan.ChooseNumber9 = PaiLieZhiXuan.ChooseNumber9.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber9Count--;
                                break;
                            case "p11":
                                PaiLieZhiXuan.ChooseNumber11 = PaiLieZhiXuan.ChooseNumber11.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber11Count--;
                                break;
                            case "p12":
                                PaiLieZhiXuan.ChooseNumber12 = PaiLieZhiXuan.ChooseNumber12.replace((item.text() + ""), '');
                                PaiLieZhiXuan.ChooseNumber12Count--;
                                break;
                        }
                    }
                }
                else {
                    if (id == "p1000") {
                        item.addClass("select");
                        $("#19").addClass("select");
                        $("#20").addClass("select");
                        PaiLieZhiXuan.HongTuoCout=1;
                        PaiLieZhiXuan.HongTuo="19,20";
                    } else {
                        item.addClass("select");
                        switch (id) {
                            case "p10":
                                PaiLieZhiXuan.ChooseNumber10 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber10Count++;
                                break;
                            case "p100":
                              
                                PaiLieZhiXuan.ChooseNumber100 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber100Count++;
                                break;
                            case "p2":
                                PaiLieZhiXuan.ChooseNumber2 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber2Count++;
                                break;
                            case "p3":
                                PaiLieZhiXuan.ChooseNumber3 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber3Count++;
                                break;
                            case "p4":
                                PaiLieZhiXuan.ChooseNumber4 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber4Count++;
                                break;
                            case "p5":
                                PaiLieZhiXuan.ChooseNumber5 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber5Count++;
                                break;
                            case "p6":
                                PaiLieZhiXuan.ChooseNumber6 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber6Count++;
                                break;
                            case "p7":
                                PaiLieZhiXuan.ChooseNumber7 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber7Count++;
                                break;
                            case "p8":
                                PaiLieZhiXuan.ChooseNumber8 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber8Count++;
                                break;
                            case "p9":
                                PaiLieZhiXuan.ChooseNumber9 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber9Count++;
                                break;
                            case "p11":

                                PaiLieZhiXuan.ChooseNumber11 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber11Count++;
                                break;
                            case "p12":

                                PaiLieZhiXuan.ChooseNumber12 += item.text() + "";
                                PaiLieZhiXuan.ChooseNumber12Count++;
                                break;
                        }
                    }
                }
                $("#前一数投").attr("checked", function (index, attr) {
                    if (attr == true) {

                        $(".play_play_input #sumcount font").html('0');
                        $(".play_play_input #sumcount font").html(PaiLieZhiXuan.ChooseNumber10Count + PaiLieZhiXuan.ChooseNumber100Count);
                    }
                });
                 $("#前一红投").attr("checked", function (index, attr) {
                    if (attr == true) {

                        $(".play_play_input #sumcount font").html('0');
                        $(".play_play_input #sumcount font").html(PaiLieZhiXuan.HongTuoCout);
                    }
                });
                $("#选二连直").attr("checked", function (index, attr) {
                    if (attr == true) {
                        $(".play_play_input #sumcount font").html('0');
                        var result1 = PaiLieZhiXuan.ChooseNumber2Count + PaiLieZhiXuan.ChooseNumber3Count;
                        var result2 = PaiLieZhiXuan.ChooseNumber4Count + PaiLieZhiXuan.ChooseNumber5Count;
                        var num2 = (PaiLieZhiXuan.ChooseNumber2 + PaiLieZhiXuan.ChooseNumber3);
                        num2 = num2.substring(0, num2.lastIndexOf(" "));

                        var num3 = (PaiLieZhiXuan.ChooseNumber4 + PaiLieZhiXuan.ChooseNumber5);
                        num3 = num3.substring(0, num3.lastIndexOf(" "));
                        var count = 0;
                        if (result1 == 0 || result2 == 0) {
                            count = 0
                        } else {

                            for (var i = 0; i < num2.split(/\s+/g).length; i++) {
                                for (var j = 0; j < num3.split(/\s+/g).length; j++) {
                                    if (num2.split(/\s+/g)[i].toString() != num3.split(/\s+/g)[j].toString())
                                        count += 1;
                                }
                            }

                        }
                        $(".play_play_input #sumcount font").html(count);
                    }
                });

                $("#选三前直").attr("checked", function (index, attr) {
                    if (attr == true) {
                        $(".play_play_input #sumcount font").html('0');
                        var result1 = PaiLieZhiXuan.ChooseNumber6Count + PaiLieZhiXuan.ChooseNumber7Count;
                        var result2 = PaiLieZhiXuan.ChooseNumber8Count + PaiLieZhiXuan.ChooseNumber9Count;
                        var result3 = PaiLieZhiXuan.ChooseNumber11Count + PaiLieZhiXuan.ChooseNumber12Count;
                        var num2 = (PaiLieZhiXuan.ChooseNumber6 + PaiLieZhiXuan.ChooseNumber7);
                        num2 = num2.substring(0, num2.lastIndexOf(" "));

                        var num3 = (PaiLieZhiXuan.ChooseNumber8 + PaiLieZhiXuan.ChooseNumber9);
                        num3 = num3.substring(0, num3.lastIndexOf(" "));

                        var num4 = (PaiLieZhiXuan.ChooseNumber11 + PaiLieZhiXuan.ChooseNumber12);
                        num4 = num4.substring(0, num4.lastIndexOf(" "));
                        
                        var count = 0;
                        if (result1 == 0 || result2 == 0 || result3 == 0) {
                            count = 0
                        } else {

                            for (var i = 0; i < num2.split(/\s+/g).length; i++) {
                                for (var j = 0; j < num3.split(/\s+/g).length; j++) {
                                    for (var k = 0; k < num4.split(/\s+/g).length; k++) {
                                        if (num2.split(/\s+/g)[i].toString() != num3.split(/\s+/g)[j].toString() && num2.split(/\s+/g)[i].toString() != num4.split(/\s+/g)[k].toString() && num3.split(/\s+/g)[j].toString() != num4.split(/\s+/g)[k].toString())
                                            count += 1;
                                    }
                                }
                            }

                        }
                        $(".play_play_input #sumcount font").html(count);
                    }
                });
            });

            PaiLieZhiXuan = {};
            PaiLieZhiXuan.ChooseNumber = [];
            PaiLieZhiXuan.PlayModels = [];
            PaiLieZhiXuan.ChooseNumber100 = "";
            PaiLieZhiXuan.ChooseNumber10 = "";
            PaiLieZhiXuan.ChooseNumber2 = "";
            PaiLieZhiXuan.ChooseNumber3 = "";
            PaiLieZhiXuan.ChooseNumber4 = "";
            PaiLieZhiXuan.ChooseNumber5 = "";
            PaiLieZhiXuan.ChooseNumber6 = "";
            PaiLieZhiXuan.ChooseNumber7 = "";
            PaiLieZhiXuan.ChooseNumber8 = "";
            PaiLieZhiXuan.ChooseNumber9 = "";
            PaiLieZhiXuan.ChooseNumber11 = "";
            PaiLieZhiXuan.ChooseNumber12 = "";
            PaiLieZhiXuan.HongTuo="";
            PaiLieZhiXuan.ChooseNumber10Count = 0;
            PaiLieZhiXuan.ChooseNumber100Count = 0;
            PaiLieZhiXuan.ChooseNumber2Count = 0;
            PaiLieZhiXuan.ChooseNumber3Count = 0;
            PaiLieZhiXuan.ChooseNumber4Count = 0;
            PaiLieZhiXuan.ChooseNumber5Count = 0;
            PaiLieZhiXuan.ChooseNumber6Count = 0;
            PaiLieZhiXuan.ChooseNumber7Count = 0;
            PaiLieZhiXuan.ChooseNumber8Count = 0;
            PaiLieZhiXuan.ChooseNumber9Count = 0;
            PaiLieZhiXuan.ChooseNumber11Count = 0;
            PaiLieZhiXuan.ChooseNumber12Count = 0;
            PaiLieZhiXuan.HongTuoCout=0;
            PaiLieZhiXuan.PlayID=<%=Model.ID %>;
            PaiLieZhiXuan.PlayName='<%=Model.Name%>';

            PaiLieZhiXuan.SetCurrentPlay = function(id, name) {
                PaiLieZhiXuan.PlayID = id;
                PaiLieZhiXuan.PlayName = name;
                
                Site.Lottery.Bet.SetCurrentPlay(PaiLieZhiXuan.PlayID, PaiLieZhiXuan.PlayName);
            };

            PaiLieZhiXuan.addScheme = function() {
                PaiLieZhiXuan.PlayModels['前一数投'] = { ID: '<%=(int)ViewData["QianYiShuTou"] %>', Name: '<%=((PlayType_E)ViewData["QianYiShuTou"]).GetName() %>', Numbers: '' };
                PaiLieZhiXuan.PlayModels['前一红投'] = { ID: '<%=(int)ViewData["QianYiHongTou"] %>', Name: '<%=((PlayType_E)ViewData["QianYiHongTou"]).GetName() %>', Numbers: '' };
                PaiLieZhiXuan.PlayModels['选二连直'] = { ID: '<%=(int)ViewData["XuanErLianZhi"] %>', Name: '<%=((PlayType_E)ViewData["XuanErLianZhi"]).GetName() %>', Numbers: '' };
                PaiLieZhiXuan.PlayModels['选三前直'] = { ID: '<%=(int)ViewData["XuanSanQianZhi"] %>', Name: '<%=((PlayType_E)ViewData["XuanSanQianZhi"]).GetName() %>', Numbers: '' };
                $("#前一数投").attr("checked", function(index, attr) {
                    if (attr == true) {

                        $(".play_play_input #sumcount font").html('0');

                        var number = (PaiLieZhiXuan.ChooseNumber10.substring(0, PaiLieZhiXuan.ChooseNumber10.lastIndexOf(' ')) + "," + PaiLieZhiXuan.ChooseNumber100);
                        if (PaiLieZhiXuan.ChooseNumber100 == "") {
                            number = PaiLieZhiXuan.ChooseNumber10.substring(0, PaiLieZhiXuan.ChooseNumber10.lastIndexOf(' '));
                        } else {
                            number = number.substring(0, number.lastIndexOf(' '));
                        }
                        $(".play_play_input #sumcount font").html(PaiLieZhiXuan.ChooseNumber10Count + PaiLieZhiXuan.ChooseNumber100Count);
                        if (PaiLieZhiXuan.ChooseNumber10Count + PaiLieZhiXuan.ChooseNumber100Count == 0) {
                            alert("选择的号码不正确");
                            return;
                        }
                        $(".number").removeClass("select");
                        if (PaiLieZhiXuan.ChooseNumber10 == "") {
                            number = PaiLieZhiXuan.ChooseNumber100;
                            number = number.substring(0, number.lastIndexOf(' '));
                            Site.Lottery.Bet.AddPlayItem(PaiLieZhiXuan.PlayID, "前一数投", number, (PaiLieZhiXuan.ChooseNumber10Count + PaiLieZhiXuan.ChooseNumber100Count), 1);
                        } else {
                            Site.Lottery.Bet.AddPlayItem(PaiLieZhiXuan.PlayID, "前一数投", number, (PaiLieZhiXuan.ChooseNumber10Count + PaiLieZhiXuan.ChooseNumber100Count), 1);
                        }

                    }
                });
                $("#前一红投").attr("checked", function(index, attr) {
                    if (attr == true) {

                        $(".play_play_input #sumcount font").html('0');
                        if (PaiLieZhiXuan.HongTuoCout == 0) {
                            alert("选择的号码不正确");
                            return;
                        }
                        $(".number").removeClass("select");
                        Site.Lottery.Bet.AddPlayItem(PaiLieZhiXuan.PlayModels["前一红投"].ID, PaiLieZhiXuan.PlayModels["前一红投"].Name, PaiLieZhiXuan.HongTuo, 1, 1)
                    }
                });
                $("#选二连直").attr("checked", function(index, attr) {
                    if (attr == true) {
                        $(".play_play_input #sumcount font").html('0');
                        var result1 = PaiLieZhiXuan.ChooseNumber2Count + PaiLieZhiXuan.ChooseNumber3Count;
                        var result2 = PaiLieZhiXuan.ChooseNumber4Count + PaiLieZhiXuan.ChooseNumber5Count;
                        var num2 = (PaiLieZhiXuan.ChooseNumber2 + PaiLieZhiXuan.ChooseNumber3);
                        num2 = num2.substring(0, num2.lastIndexOf(" "));

                        var num3 = (PaiLieZhiXuan.ChooseNumber4 + PaiLieZhiXuan.ChooseNumber5);
                        num3 = num3.substring(0, num3.lastIndexOf(" "));
                        var count = 0;
                        if (result1 == 0 || result2 == 0) {
                            count = 0;
                        } else {

                            for (var i = 0; i < num2.split(" ").length - 1; i++) {
                                for (var j = 0; j < num3.split(" ").length - 1; j++) {
                                    if (num2.split(" ")[i].toString() != num3.split(" ")[j].toString())                                      
                                        count += 1;
                                }
                            }

                        }
                        if (count == 0) {
                            alert("选择的号码不正确");
                            return;
                        }
                        $(".number").removeClass("select");
                        Site.Lottery.Bet.AddPlayItem(PaiLieZhiXuan.PlayModels["选二连直"].ID, PaiLieZhiXuan.PlayModels["选二连直"].Name, (num2 + "," + num3), count, 1)
                    }
                });

                $("#选三前直").attr("checked", function(index, attr) {
                    if (attr == true) {
                        $(".play_play_input #sumcount font").html('0');
                        var result1 = PaiLieZhiXuan.ChooseNumber6Count + PaiLieZhiXuan.ChooseNumber7Count;
                        var result2 = PaiLieZhiXuan.ChooseNumber8Count + PaiLieZhiXuan.ChooseNumber9Count;
                        var result3 = PaiLieZhiXuan.ChooseNumber11Count + PaiLieZhiXuan.ChooseNumber12Count;
                        var num2 = (PaiLieZhiXuan.ChooseNumber6 + PaiLieZhiXuan.ChooseNumber7);
                        num2 = num2.substring(0, num2.lastIndexOf(" "));

                        var num3 = (PaiLieZhiXuan.ChooseNumber8 + PaiLieZhiXuan.ChooseNumber9);
                        num3 = num3.substring(0, num3.lastIndexOf(" "));

                        var num4 = (PaiLieZhiXuan.ChooseNumber11 + PaiLieZhiXuan.ChooseNumber12);
                        num4 = num4.substring(0, num4.lastIndexOf(" "));

                        var count = 0;
                        if (result1 == 0 || result2 == 0 || result3 == 0) {
                            count = 0;
                        } else {

                            for (var i = 0; i < num2.split(' ').length; i++) {
                                for (var j = 0; j < num3.split(' ').length; j++) {
                                    for (var k = 0; k < num4.split(' ').length; k++) {
                                        if (num2.split(' ')[i].toString() != num3.split(' ')[j].toString() && num2.split(' ')[i].toString() != num4.split(' ')[k].toString() && num3.split(' ')[j].toString() != num4.split(' ')[k].toString())
                                            count += 1;
                                    }
                                }
                            }

                        }
                        if (count == 0) {
                            alert("选择的号码不正确");
                            return;
                        }
                        $(".number").removeClass("select");
                        Site.Lottery.Bet.AddPlayItem(PaiLieZhiXuan.PlayModels["选三前直"].ID, "选三前值", (num2 + "," + num3 + "," + num4), count, 1)
                    }
                });

            };
      

            $("#前一数投").click(function () {
                $("#前一数投").attr("checked", function (index, attr) {
                    if (attr == true) {
                        $(".tb1").css('display', 'block');
                        $(".tb2").css('display', 'none');
                        $(".tb3").css('display', 'none');
                        $(".tb4").css('display', 'none');
                    }
                });
            });
            $("#前一红投").click(function () {
                $("#前一红投").attr("checked", function (index, attr) {
                    if (attr == true) {
                        $(".tb2").css('display', 'block');
                        $(".tb1").css('display', 'none');
                        $(".tb3").css('display', 'none');
                        $(".tb4").css('display', 'none');
                    } 
                });
            });
            $("#选二连直").click(function () {
                $("#选二连直").attr("checked", function (index, attr) {
                    if (attr == true) {
                        $(".tb3").css('display', 'block');
                        $(".tb2").css('display', 'none');
                        $(".tb1").css('display', 'none');
                        $(".tb4").css('display', 'none');
                    } 
                });
            });
            $("#选三前直").click(function () {
                $("#选三前直").attr("checked", function (index, attr) {
                    if (attr == true) {
                        $(".tb4").css('display', 'block');
                        $(".tb2").css('display', 'none');
                        $(".tb3").css('display', 'none');
                        $(".tb1").css('display', 'none');
                    } 
                });
            });

            PaiLieZhiXuan.PlayModels['前一数投'] = { ID: '<%=(int)ViewData["QianYiShuTou"] %>', Name: '<%=((PlayType_E)ViewData["QianYiShuTou"]).GetName() %>', Numbers: '' };
            PaiLieZhiXuan.PlayModels['前一红投'] = { ID: '<%=(int)ViewData["QianYiHongTou"] %>', Name: '<%=((PlayType_E)ViewData["QianYiHongTou"]).GetName() %>', Numbers: '' };
            PaiLieZhiXuan.PlayModels['选二连直'] = { ID: '<%=(int)ViewData["XuanErLianZhi"] %>', Name: '<%=((PlayType_E)ViewData["XuanErLianZhi"]).GetName() %>', Numbers: '' };
            PaiLieZhiXuan.PlayModels['选三前直'] = { ID: '<%=(int)ViewData["XuanSanQianZhi"] %>', Name: '<%=((PlayType_E)ViewData["XuanSanQianZhi"]).GetName() %>', Numbers: '' };
            var isSingle=<%="true".Equals(TempData["singleplay"] as string)?"true":"false" %>;
            $("#input_model :radio").each(function() {
                var item = $(this);
                item.click(function() {
                    var val = parseInt(this.value);

                    $(".play_play_input #sumcount font").html('0');
                    $(".number").removeClass("select");
                    var play = PaiLieZhiXuan.PlayModels[this.id];
                    if (this.value == -1) {
                        $(".play_play_input #sumcount font").html('0');
                        PaiLieZhiXuan.SetCurrentPlay(play.ID, play.Name);
                    } else {
                        $(".play_play_input #input_" + this.value + " .number:first").click().click();

                        if (PaiLieZhiXuan.PlayID == val) {
                            PaiLieZhiXuan.SetCurrentPlay(play.ID, play.Name);
                            return;
                        }
                        if (isSingle) {
                            location.href = item.attr('surl');
                            return;
                        }
                        var url = '<%=Url.Action("Play",new {p1="!"}) %>/'.replace("!", val);
                        $("#play_bet_bar").block({ message: "<img src='<%=Url.Content("~/Content/images/busy.gif") %>'/>载入中...", css: { cursor: "default" }, overlayCSS: { cursor: "default" } });
                        $("#play_bet_bar").load(url, null, function(p, e, i) {
                            $("#play_bet_bar").unblock();
                            if (e == 'success' && $(p).has("#play_inputpanel")) {
                            } else {
                                $("#input_model .type" + val).click();
                                return false;
                            }
                        });
                    }
                });
                if (PaiLieZhiXuan.PlayID == parseInt(item.val()))
                    this.checked = true;
            });
            $("#input_model :radio:checked").click();
        </script>
    </div>
</div>
